﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace UtilsORM.MySqlData;

[Index("d_c_guid", Name = "d_c_guid")]
[Index("d_code", Name = "idcode", IsUnique = true)]
[Index("d_guid", Name = "idxdguid", IsUnique = true)]
[Index("d_gw_d_guid", Name = "idxgwdguid")]
[Index("d_model_guid", Name = "idxmodelguid")]
[Index("d_p_guid", Name = "idxpguid")]
[Index("d_status", Name = "idxstatus")]
[MySqlCharSet("utf8mb3")]
[MySqlCollation("utf8mb3_general_ci")]
public partial class iot_device
{
    [Key]
    public long d_id { get; set; }

    [Required]
    public string d_guid { get; set; }

    /// <summary>
    /// 设备编号
    /// </summary>
    [Required]
    [StringLength(50)]
    public string d_code { get; set; }

    /// <summary>
    /// 0启用，1禁用
    /// </summary>
    public int? d_status { get; set; }

    /// <summary>
    /// 内部名称
    /// </summary>
    [StringLength(100)]
    public string d_name { get; set; }

    /// <summary>
    /// 邦定设备类型iot_device_model
    /// </summary>
    [Required]
    public string d_model_guid { get; set; }

    public string d_c_guid { get; set; }

    /// <summary>
    /// 位置
    /// </summary>
    [StringLength(50)]
    public string d_place_guid { get; set; }

    [StringLength(50)]
    public string d_remark { get; set; }

    [Column(TypeName = "datetime")]
    public DateTime? d_mod_time { get; set; }

    [Column(TypeName = "datetime")]
    public DateTime? d_add_time { get; set; }

    /// <summary>
    /// 组别ID
    /// </summary>
    [StringLength(50)]
    public string d_group_guid { get; set; }

    /// <summary>
    /// 归属网关设备d_guid
    /// </summary>
    [StringLength(50)]
    public string d_gw_d_guid { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    public int? d_order { get; set; }

    /// <summary>
    /// 0看得见，1看不见
    /// </summary>
    public int? d_visible { get; set; }

    /// <summary>
    /// 0手工添加，1是产品设计型号，2是批量产品
    /// </summary>
    public uint d_is_template { get; set; }

    /// <summary>
    /// 绑定产品iot_device_product
    /// </summary>
    [StringLength(100)]
    public string d_p_guid { get; set; }

    /// <summary>
    /// 模板编号
    /// </summary>
    public int? d_p_model_no { get; set; }

    /// <summary>
    /// 设备参数
    /// </summary>
    public string d_parameter { get; set; }

    /// <summary>
    /// 初始化
    /// </summary>
    public string d_parameter_init { get; set; }

    /// <summary>
    /// 设备通道
    /// </summary>
    public int? d_channel { get; set; }

    /// <summary>
    /// 寄存器地址1-255
    /// </summary>
    [StringLength(50)]
    public string d_register_address { get; set; }
}
